package com.open4cn.simulator.connect.com.handler;

import com.open4cn.simulator.core.connector.serialport.MessageToByteEncoder;
import com.open4cn.simulator.core.connector.serialport.SerialPortHandlerContext;

import java.nio.charset.StandardCharsets;


/**
 * @author yinxiaopeng
 * @version 1.0.0
 * @company 致景科技
 * @department 飞梭BU/研发
 * @description
 * @Email yinxiaopeng@zj.tech
 * @date 2022-06-12 01:57
 */
public class StringToByteEncoder extends MessageToByteEncoder<String> {

    @Override
    protected void encode(SerialPortHandlerContext ctx, String msg) {
        ctx.write(new String(msg.getBytes(), StandardCharsets.US_ASCII));
    }
}
